package com.springcloud;

import java.util.*;

public class test {
    public static void main(String[] args) throws ArithmeticException{
//        test t=new test();
//        int[] nums={1,2,3,4,5,6,7,1};
//       // t.rotate(nums,8);
//       //Z System.out.println(Arrays.toString(nums));
//      //  boolean b=t.containsDuplicate(nums);
//      //  System.out.println(b);
//        System.out.println(1 ^0);
        Timer timer=new Timer();
        int x=0;
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                while (x==0){
                    System.out.println(11);


                }
            }
        },1000,4000);

    }

    public void rotate(int[] nums, int k){
        if(nums==null)return;
        int i,j,temp;
        if(k>nums.length) k%= nums.length;
        for( i=0,j=nums.length-k-1;i<j;i++,j--){
            temp =nums[i];
            nums[i]=nums[j];
            nums[j]=temp;
        }
        for(i=nums.length-k,j=nums.length-1;i<j;i++,j--){
            temp =nums[i];
            nums[i]=nums[j];
            nums[j]=temp;
        }
        for(i=0,j=nums.length-1;i<j;i++,j--){
            temp =nums[i];
            nums[i]=nums[j];
            nums[j]=temp;
        }
    }
    public boolean containsDuplicate(int[] nums) {
        Set<Integer> set=new HashSet<>();
        for(int num:nums){
            if(!set.add(num)) return true;
        }
        return false;
    }
    public int singleNumber(int[] nums) {
        int result=0;
        for(int num:nums){
            result ^=num;
        }
        return  result;
    }
}
class getMoney implements  Runnable{
    private int money=1000;
    @Override
    public void run() {
        while(true){
            synchronized (this) {
                if (money <= 0) break;

                money -= 100;
                System.out.println(Thread.currentThread().getName() + " " + money);
            }
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }

}
